<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>
<@head>
<link rel="stylesheet" href="/misc/app/jq-liandong/area.css"/>
<style type="text/css">
    .ci{float: left;padding:7px 0 0 5px}
    .over_box{padding-top: 5px;overflow: hidden;zoom: 1;}
    .over_radio{float: left;margin:10px 5px 0 5px !important;}
    .over_text{width:90px;float: left;}
</style>
</@head>
<@body>
<script src="/misc/app/js/salesman_list.js"></script>
<script src="/misc/app/jq-liandong/cityJson.js"></script>
<script src="/misc/app/jq-liandong/citySet.js"></script>
<script src="/misc/app/jq-liandong/Popt.js"></script>
</@body>
<@layout_default>
<div class="box">
    <div class="box-header with-border">
        <span class="pull-right text-muted">共 ${salesmanList.resultTotal} 条记录</span>
        <input type="hidden" id="resultTotal_hidden" value="${salesmanList.resultTotal}" />
        <form class="form-inline" action="/salesman">
            <div class="input-group">
                <div class="input-group-addon">促销员</div>
                <input type="text" class="form-control" style="width: 260px" name="keyword" value="${keyword!}" placeholder="姓名、手机号"/>
            </div>
            <div class="input-group">
                <div class="input-group-addon">门店名称</div>
                <input type="text" class="form-control" style="width: 260px" name="branchkeyword" value="${branchkeyword!}" placeholder="门店名称"/>
            </div>
            <div class="input-group" id="regionDiv">
                <label class="input-group-addon">门店所在地</label>
                <input type="text" class="form-control area"  style="width:300px;float:left;" value="${adname!}"  name="adname" readonly="readonly"/>
            </div>
            <div class="input-group">
                <div class="input-group-addon">状态</div>
                <select class="form-control" name="state">
                    <option value="">全部</option>
                    <option value="0" ${(state?exists && state == 1)?string("selected","")}>审核中</option>
                    <option value="1" ${(state?exists && state == 1)?string("selected","")}>正常</option>
                    <option value="2" ${(state?exists && state == 2)?string("selected","")}>已注销</option>
                    <option value="3" ${(state?exists && state == 2)?string("selected","")}>审核不通过</option>
                </select>
            </div>

            <button type="submit" class="btn btn-warning"><i class="fa fa-search"></i> 查询</button>
            <!-- <button type="button" class="btn btn-default" name="btn_new_salesman" data-toggle="modal" data-target="#md_new_salesman"><i class="fa fa-plus"></i> 新增促销员</button> -->
            <#--<button type="button" class="btn btn-default" data-toggle="modal" data-target="#md_sync_user_to_qyh"><i class="fa fa-random"></i> 同步至企业号通讯录</button>-->
        </form>
    </div>
    <!-- /.box-header -->
    <div class="box-body">
        <table class="table table-striped table-hover">
            <tr>
                <th>编号</th>
                <th>促销员姓名</th>
                <th>手机号</th>
                <th>门店名称</th>
                <th>门店所在地</th>
                <th>负责业务员</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            <#if (salesmanList.result?size > 0)>
                <#list salesmanList.result as item>
                    <tr>
                        <td>${item.code}</td>
                        <td>${item.name}</td>
                        <td>${item.phone}</td>
                        <td>${item.branchname!}</td>
                        <td>${item.adname}</td>
                        <td>${item.psnname!}</td>
                        <td><#if item.state==1><span class="text-green">正常</span><#elseif item.state==2><span class="text-yellow">已注销</span><#elseif item.state==3><span class="text-danger">审核不通过</span><#elseif item.state==0><span class="text-danger">未审核</span></#if></td>
                        <td>
                            <a href="/salesman/${item.id}" class="btn btn-default btn-xs">查看</a>
                            <!-- <button type="button" class="btn btn-default btn-xs" data-toggle="modal" data-target="#md_edit_salesman" data-salesman-id="${item.id}">查看</button> -->
                            <!-- <button type="button" class="btn btn-default btn-xs" name="btn_delete_salesman" data-salesman-id="${item.id}">删除</button> -->
                        </td>
                    </tr>
                </#list>
            <#else>
                <tr>
                    <td class="text-center text-muted" colspan="9"><i class="fa fa-info-circle"></i> 没有记录</td>
                </tr>
            </#if>
        </table>
        <table class="table table-striped table-hover">
        	<tr>
        		<td colspan="13" style="text-align:right;background-color:white;">
        			<a href="javascript:void(0);" name="btn_export"><i class="glyphicon glyphicon-save"></i> 数据导出</a>
        		</td>
        	</tr>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer text-center">
        <@components.pagination "/salesman?keyword=${keyword!}&state=${state!}&branchkeyword=${branchkeyword!}&adname=${adname!}&page=$page",salesmanList.page,salesmanList.pageTotal/>
    </div>
</div>
</@layout_default>